using System;
using CommandSystem;

namespace RgCore.CustomSide.Commands.SideManagerCommands
{
    [CommandHandler(typeof(RemoteAdminCommandHandler))]
    public class SideManagerCommand : ParentCommand, IUsageProvider
    {
        public SideManagerCommand() => LoadGeneratedCommands();

        public override string Command => "sidemanager";

        public override string[] Aliases => new string[] { "sidem" };

        public override string Description => "阵营控制";

        public string[] Usage => new string[]
        {
            "list/set", "玩家ID(set必选)", "阵营ID(不填则取消自定义阵营)"
        };


        public override void LoadGeneratedCommands()
        {
            this.RegisterCommand(new List());
            this.RegisterCommand(new Set());
        }

        protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSender sender,
            out string response)
        {
            if (!sender.CheckPermission(PlayerPermissions.ForceclassWithoutRestrictions))
            {
                response = $"权限不足,需要{nameof(PlayerPermissions.ForceclassWithoutRestrictions)}权限";
                return false;
            }

            response = "用法：sidem list 或 sidem set <玩家ID> [阵营ID]";
            return false;
        }
    }
}